home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1993 / MacHack 1993.toast / MacHack™ 1987-1992 / MacHack™ '90 / Other Stuff / Demos ƒ / Demo AppMaker / Demo AppMaker™ / Demo AppMaker™.rsrc / TmpP_106_ModalDialog < prev    next >
Encoding:
Text File  |  1990-03-23  |  1.8 KB  |  102 lines

  1. { %filename% -- Modal dialog }
  2. { Created %date% %time% by AppMaker }
  3.  
  4. Unit %unitname%;
  5. Interface
  6.  
  7. Uses
  8. %if lang = MPW%
  9.     {$Load ToolBox.dump}
  10.         MemTypes,
  11.         QuickDraw,
  12.         OSIntf,
  13.         ToolIntf,
  14.         PackIntf,
  15.     {$Load}
  16.  
  17. %end if%
  18. %if lang = Think%
  19. {$ifc undefined Think_Pascal}
  20.     ListManager,
  21. {$endc}
  22. %end if%
  23.     ResourceDefs,
  24.     DialogAids;
  25.  
  26. Type
  27.     %dlogname%Rec = record
  28.         %for each item gen dialog field%
  29.     end;
  30.  
  31. {----------}
  32. Function Get%dlogname% (var %dlogname%:    %dlogname%Rec): boolean;
  33.  
  34. {----------}
  35. Implementation
  36.  
  37. %if lang = MPW%
  38. {$D+}
  39. {$R+}
  40. {$OV+}
  41.  
  42. %end if%
  43. const
  44.     %for each item gen itemNr%
  45.  
  46. %if lang = MPW%
  47. {$S %unitname%}
  48.  
  49. %end if%
  50. %for each item gen auxiliary%
  51. %if needsFilter%
  52.     {----------}
  53.     Function Filter%dlogname% (whichDialog:    DialogPtr;
  54.                  var event:            EventRecord;
  55.                  var itemHit:        integer): boolean;
  56.     var
  57.         filtered:        boolean;
  58.     Begin
  59.         filtered := false;
  60.             %for each item gen filter%
  61.         if not filtered then begin
  62.             filtered := StandardFilter (whichDialog, event, itemHit);
  63.         end;
  64.         Filter%dlogname% := filtered;
  65.     End; {Filter%dlogname%}
  66. %endif%
  67.  
  68. {----------}
  69. Function Get%dlogname% {(var %dlogname%:    %dlogname%Rec): boolean};
  70. var
  71.     result:            boolean;
  72.     theDialog:        DialogPtr;
  73.     done:            boolean;
  74.     itemNr:            integer;
  75. Begin
  76.     InitCursor;
  77.     theDialog := GetNewDialog (%dlogname%ID, nil, pointer (-1));
  78.     SetPort (theDialog);
  79.     with %dlogname% do begin
  80.         %for each item gen set%
  81.         ShowWindow (theDialog);
  82.         OutlineButton (1);
  83.         done := false;
  84.         while not done do begin
  85.             %for each item gen enable%
  86.     %if needsFilter%
  87.                 ModalDialog (@Filter%dlogname%, itemNr);
  88.     %else%
  89.                 ModalDialog (nil, itemNr);
  90.     %end if%
  91.             case itemNr of
  92.             %for each item gen hit%
  93.             end; {case}
  94.         end; {while}
  95.         %for each item gen finish%
  96.     end; {with}
  97.     DisposDialog (theDialog);
  98.     Get%dlogname% := result;
  99. End; {Get%dlogname%}
  100.  
  101. End. {%unitname%}
  102.